using System;
using Headspring.Training.DependencyResolution;
using NUnit.Framework;
using StructureMap;
using StructureMap.Graph;

namespace Headspring.Training.IntegrationTests
{
	[TestFixture]
	public class DependencyRegistrarTester
	{
		[Test]
		public void Should_create_everything_that_is_registered()
		{
			var registrar = new DependencyRegistrar();
			registrar.RegisterDependencies();

			PluginFamilyCollection families =
				StructureMapConfiguration.GetPluginGraph().PluginFamilies;
			Assert.That(families.Count > 0);

			foreach (PluginFamily family in families)
			{
				Type type = family.PluginType;
				ObjectFactory.GetInstance(type);
			}

			Console.WriteLine("{0} classes registered with IoC container", families.Count);
		}
	}
}